﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.IotInfo;
using LJX.SmartPark.Domain.IotInfo.LightPoles;
using LJX.SmartPark.Service.IotInfo;
using LJX.SmartPark.Service.IotInfo.LightPoles;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SelectRizhi = LJX.SmartPark.Service.IotInfo.SelectRizhi;

namespace LJX.SmartPark.WebApi.Controllers.IotInfo
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "IotInfo")]
    public class LightPolesController : ControllerBase
    {
        private readonly ILightPolesServeice _lightpolesService;

        public LightPolesController(ILightPolesServeice lightpolesService)
        {
            _lightpolesService = lightpolesService;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostAddStudent(LightPoles input)
        {
            var result = _lightpolesService.PostAddLightPolesListAsync(input);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeleteStudent(LightPoles input)
        {
            var result = _lightpolesService.DeleteLightPolesAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateStudent(LightPoles input)
        {
            var result = _lightpolesService.PutUpdLightPolesListAsync(input);

            return result;

        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _lightpolesService.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<LightPoles>> GetTricolourLightAsync(SelectRizhi select)
        {
            var result = _lightpolesService.GetLightPolesAsync(select);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<LightPoles> GetTricolourLightById(LightPoles input)
        {
            var student = _lightpolesService.GetLightPolesById(input);
            return student;
        }
    }
}
